package com.future.future.movie.controller;

import java.util.Arrays;
import java.util.Map;

import com.future.future.commons.utils.PageUtils;
import com.future.future.commons.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.future.future.movie.entity.Movie1Entity;
import com.future.future.movie.service.Movie1Service;

/**
 * 
 *
 * @author sn
 * @email sn@gmail.com
 * @date 2021-01-18 17:15:04
 */
@RestController
@RequestMapping("movie/movie1")
public class Movie1Controller {
    @Autowired
    private Movie1Service movie1Service;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = movie1Service.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
		Movie1Entity movie1 = movie1Service.getById(id);

        return R.ok().put("movie1", movie1);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody Movie1Entity movie1){
		movie1Service.save(movie1);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody Movie1Entity movie1){
		movie1Service.updateById(movie1);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
		movie1Service.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
